{template 'public/header'}

{template 'public/comhead'}

<link rel="stylesheet" type="text/css" href="../addons/yzzc_sun/template/public/ygcsslist.css">
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>
    <li  {if $type=='all'} class="active" {/if}><a href="{php echo $this->createWebUrl('storelist',array('type'=>all));}">全部商家</a></li>
</ul>
<br>
<div class="row ygrow">
    <div class="col-lg-12">
        <form action="" method="get" class="col-md-4">
            <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="yzzc_sun" />
            <input type="hidden" name="do" value="storelist" />
            <div class="input-group">
                <input type="text" name="keywords" class="form-control" placeholder="请输入商家名称">
                <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit" value="查找"/>
                </span>
            </div>
            <input type="hidden" name="token" value="{$_W['token']}"/>
        </form>

        <div class="col-md-4">
            <input type="hidden" name="token" value="{$_W['token']}"/>
        </div>
    </div><!-- /.col-lg-6 -->
</div>

<!--<div class="row ygrow">-->
<!--    <div class='col-lg-12'>-->
<!--        <a  href="{php echo $this->createWebUrl('storelist',array('op'=>add));}"><button class="btn btn-sm store-blue">添加商家</button></a>-->
<!--    </div>-->
<!--</div>-->
<div class="main ">

    <div class="panel panel-default">
        <div class="panel-heading">
            入驻申请
        </div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row" id="accordion">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
                        <td  class="store_td1">类型</td>
                        <td  class="store_td1 col-md-1">姓名</td>
                        <td  class="store_td1 col-md-1">电话</td>
                        <td  class="col-md-2">入驻区域</td>
                        <td  class="col-md-2">详细地址</td>
                        <td  class="col-md-1">备注</td>
                        <td class="col-md-1">申请状态</td>
                        <td class="col-md-1">入驻费用</td>
                        <td class="col-md-1">申请时间</td>
                        <td>操作</td>
                    </tr>
                    {loop $info $key $item}
                    <tbody>
                    <tr class="yg5_tr2" >
                        <td>
                            {if $item['type']==1}
                            <span class="label store-green btn btn-sm">商户入驻</span>
                            {else}
                            <span class="label store-red btn btn-sm">个人车主</span>
                            {/if}
                        </td>
                        <td>{$item['name']}</td>
                        <td>{$item['mobile']}</td>
                        <td>{$item['province']}-{$item['city']}-{$item['area']}</td>
                        <td>{$item['address']}</td>
                        <td>{$item['remark']}</td>
                        <td>
                            {if $item['status']==0}
                            <span class="label store-yellow btn btn-sm">审核中</span>
                            {elseif $item['status']==1}
                            <span class="label store-green btn btn-sm">审核通过</span>
                            {elseif $item['status']==2}
                            <span class="label store-red btn btn-sm">审核拒绝</span>
                            {/if}
                        </td>
                        <td>
                            {if $item['pay_status']==0}
                            <span class="label store-yellow btn btn-sm">待支付</span>
                            {elseif $item['pay_status']==1}
                            <span class="label store-green btn btn-sm">已支付</span>
                            {elseif $item['pay_status']==2}
                            <span class="label store-yellow btn btn-sm">不收取</span>
                            {/if}
                        </td>
                        <td>{$item['createtime']}</td>
                        <td>
                            {if $item['status']==0}
                            <a href="javascript:void(0);" class="storespan btn btn-xs" data-toggle="modal" data-target="#fee{$item['store_id']}">
                                <span class="btn btn-md ygyouhui2">通过</span>
                            </a>
                            <a href="javascript:void(0);" class="storespan btn btn-xs" data-toggle="modal" data-target="#myModal{$item['store_id']}">
                                <span class="btn btn-md ygyouhui2">拒绝</span>
                            </a>

                            {/if}
<!--                            {if $item['status']==1 && $item['is_disable'] == 1}-->
<!--                            <a href="javascript:void(0);" onclick="isDisable({$item['store_id']},0)" class="storespan btn btn-xs" >-->
<!--                                <span class="btn btn-md ygyouhui2">禁用</span>-->
<!--                            </a>-->
<!--                            {/if}-->
<!--                            {if $item['status']==1 && $item['is_disable'] == 0}-->
<!--                            <a href="javascript:void(0);" onclick="isDisable({$item['store_id']},1)" class="storespan btn btn-xs" >-->
<!--                                <span class="btn btn-md ygyouhui2">解除禁用</span>-->
<!--                            </a>-->
<!--                            {/if}-->
                            <a href="{php echo $this->createWebUrl('store_apply', array('store_id' => $item['store_id'],'op'=>edit))}" class="storespan btn btn-xs">
                               申请详情
                            </a>
<!--                            <a href="javascript:;" class="storespan btn btn-xs" onclick="del({$item['store_id']})">-->
<!--                                <span class="fa fa-trash-o"></span><span class="bianji">删除<span class="arrowdown"></span></span>-->
<!--                            </a>-->
                        </td>
                    </tr>
                    </tbody>
                    <div class="modal fade" id="myModal{$item['store_id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                        <div class="modal-dialog" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                    <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">拒绝备注</h4>
                                </div>
                                <form action="" method="get" >
                                    <input type="hidden" name="c" value="site" />
                                    <input type="hidden" name="a" value="entry" />
                                    <input type="hidden" name="m" value="yzzc_sun" />
                                    <input type="hidden" name="do" value="store_apply" />
                                    <input type="hidden" name="id" value="{$item['store_id']}" />
                                    <input type="hidden" name="op" value="change" />
                                    <input type="hidden" name="status" value="2" />
                                    <div class="modal-body" style="font-size: 20px">
                                        <input type="text" name="remark" placeholder="拒绝理由" class="form-control"/>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                        <input type="submit" class="btn btn-info" name="submit" value="确定"/>
                                    </div>
                                    <input type="hidden" name="token" value="{$_W['token']}"/>
                                </form>
                            </div>
                        </div>
                    </div>
                    <div class="modal fade" id="fee{$item['store_id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                        <div class="modal-dialog" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                    <h4 class="modal-title" id="fee" style="font-size: 20px;">手续费设置</h4>
                                </div>
                                <form action="" method="post" >
                                    <input type="hidden" name="c" value="site" />
                                    <input type="hidden" name="a" value="entry" />
                                    <input type="hidden" name="m" value="yzzc_sun" />
                                    <input type="hidden" name="do" value="store_apply" />
                                    <input type="hidden" name="id" value="{$item['store_id']}" />
                                    <input type="hidden" name="op" value="change" />
                                    <input type="hidden" name="status" value="1" />
                                    <div class="modal-body" style="font-size: 20px">
                                        <input type="text" name="platform_fee" placeholder="入驻门店手续费单独设置，不设置则使用统一手续费：{$platform_fee['platform_fee']}%"  class="form-control"/>
                                    </div>
                                    <div class="modal-body" style="font-size: 20px">
                                        <input type="text" name="payout_fee" placeholder="入驻门店提现手续费单独设置，不设置则使用统一手续费：{$platform_fee['payout_fee']}%"  class="form-control"/>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                        <input type="submit" class="btn btn-info" name="submit" value="确定"/>
                                    </div>
                                    <input type="hidden" name="token" value="{$_W['token']}"/>
                                </form>
                            </div>
                        </div>
                    </div>
                    {/loop}
                    {if empty($item)}
                    <tr class="yg5_tr2">
                        <td colspan="8">
                            暂无地址信息
                        </td>
                    </tr>
                    {/if}
                </table>
            </div>
        </div>

    </div>
    </form>
</div>
<script type="text/javascript">
    $(function(){
        $("#frame-16").show();
        $("#yframe-16").addClass("wyactive");
    })
    function del(id) {
        var ret = confirm("删除前请确认该门店所有车辆均已下架，您确定删除吗？")
        if (ret==true){
            $.ajax({
                type:"POST",
                url:"/web/index.php?c=site&a=entry&op=delete&do=store_personal&op=delete&module_name=yzzc_sun&version_id=1",
                dataType:"JSON",
                data:{id:id},
                success:function(res){
                    if(res.type == 'success') {
                        location.reload();
                    }else{
                        alert('删除失败');
                    }
                }
            })
        }
    }
    function isDisable(id,status) {
        var ret = ''
        if (status == 0){
            ret = confirm("您确定禁用吗？")
        }else {
            ret = confirm("您确定解除禁用吗？")
        }
        if (ret==true){
            $.ajax({
                type:"POST",
                url:"/web/index.php?c=site&a=entry&op=delete&do=store_personal&op=disable&module_name=yzzc_sun&version_id=1",
                dataType:"JSON",
                data:{id:id,is_disable:status},
                success:function(res){
                    if(res.type == 'success') {
                        location.reload();
                    }else{
                        alert('操作失败');
                    }
                }
            })
        }
    }

</script>